//
//  MMDailyCell.m
//  zhihuDaily
//
//  Created by li  bo on 16/6/12.
//  Copyright © 2016年 cc. All rights reserved.
//

#import "MMDailyCell.h"

#import "MMStoryModel.h"
@interface MMDailyCell ()

//文章cell的标题
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
//文章cell右边的配图
@property (weak, nonatomic) IBOutlet UIImageView *figureImageView;
//是否有多张配图
@property (weak, nonatomic) IBOutlet UILabel *mulFigureLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelRightCons;
@end
@implementation MMDailyCell

- (void)awakeFromNib {
    self.mulFigureLabel.hidden = YES;
    self.titleLabel.font = [UIFont boldSystemFontOfSize:15];
    self.contentView.dk_backgroundColorPicker = DKColorPickerWithKey(BG);
    self.titleLabel.dk_textColorPicker = DKColorPickerWithKey(TEXT);
}

- (void)setStoryModel:(MMStoryModel *)storyModel
{
    _storyModel = storyModel;
    self.titleLabel.text = storyModel.title;
    if (storyModel.images) {
        self.figureImageView.hidden = NO;
        self.titleLabelRightCons.constant = 15;
        [self.figureImageView sd_setImageWithURL:[NSURL URLWithString:storyModel.images[0]]];
        if (storyModel.images.count > 1) {
            self.mulFigureLabel.hidden = NO;
        }else {
            self.mulFigureLabel.hidden = YES;
        }

        [self setNeedsLayout];
    }else {
        self.titleLabelRightCons.constant = 18 - 60;
        self.figureImageView.hidden = YES;

    }


}

@end
